﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using System.Globalization;
using System.Web;
using Core.Common;
using Core.Interfaces;
using Core.DataAccess;
using Core.DataAccess.IRepositories;
using Core.BusinessLogic.Interfaces;


namespace Core.BusinessLogic
{
    [Export(typeof(IProfileEditService))]
    public class ProfileEditService : IProfileEditService
    {

        public ProfileEditService()
        {
            MEFManager.Compose(this);
        }

        public List<string> GetCountryList()
        {
            List<string> list = new List<string>();

            CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.InstalledWin32Cultures);
            foreach (CultureInfo ci in cultures)
            {
                RegionInfo info = new RegionInfo(ci.LCID);
                if (!list.Contains(info.EnglishName))
                {
                    list.Add(info.EnglishName);
                }
            }
            list.Sort();

            return list;
        }

        public List<string> GetVietnameseCityList()
        {
            string[] citiesList = System.IO.File.ReadAllLines(HttpContext.Current.Server.MapPath(@"~/lib/VietnameseCity.txt"), System.Text.Encoding.UTF8);

            return citiesList.ToList();
        }

        public List<string> GetJobFieldList()
        {
            string[] jobFieldList = System.IO.File.ReadAllLines(HttpContext.Current.Server.MapPath(@"~/lib/JobField.txt"), System.Text.Encoding.UTF8);

            return jobFieldList.ToList();
        }
    }
}
